package myHashMap;

public class MyHashMapMain {

	public static void main(String[] args) {
		System.out.println("Collision testing:");
		MyHashMap<String, String> mapStrings = new MyHashMap<String, String>();
		String one = "aaaba";
		System.out.println("\"" + one + "\" hash: " + one.hashCode());
		String two = "aaacB";
		System.out.println("\"" + two + "\" hash: " + two.hashCode());
		String three = "3";
		System.out.println("\"" + three + "\" hash: " + three.hashCode());
		mapStrings.put(one, "one");
		mapStrings.put(two, "two");
		mapStrings.put(three, "three");
		System.out.println(mapStrings.get(one));
		System.out.println(mapStrings.get(two));
		System.out.println(mapStrings.get(three));
		System.out.println(mapStrings.getKeys());
		System.out.println(mapStrings.getValues());
		
		System.out.println("Resize testing:");
		int initialCapacity = 16;
		int elemAmount = 2048;
		System.out.println("Initial capacity: " + initialCapacity);
		System.out.println("Elements amount: " + elemAmount);
		MyHashMap<Integer, Integer> mapIntegers = new MyHashMap<Integer, Integer>(initialCapacity);
		for (int i = 0; i < elemAmount; i++) {
			mapIntegers.put(i, i*2);
		}
		for (int i = 0; i < elemAmount; i++) {
			if (mapIntegers.get(i) != i*2) {
				System.out.println("Test failed!");
			}
		}
		System.out.println("Test finished");
	}

}
